package com.itqf.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.itqf.serilaize.SexSerilaizer;

import java.util.Date;

/**
 * projectName: springmvcgp8
 *
 * @author: 赵伟风
 * time: 2021/8/6 14:39
 * description:
 */
public class User {

    @JsonProperty("username")
    private String account;
    //生成json的时候忽略属性
    @JsonIgnore
    private String password;

    @JsonSerialize(using= SexSerilaizer.class)
    private int    sex;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date   birthday;
    //不为空返回 字符串或者对象属性为null
    @JsonInclude(JsonInclude.Include.NON_NULL)
//    //集合或者数组 长度wei0
//    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String info;

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    @Override
    public String toString() {
        return "User{" +
                "account='" + account + '\'' +
                ", password='" + password + '\'' +
                ", sex=" + sex +
                ", birthday=" + birthday +
                ", info='" + info + '\'' +
                '}';
    }
}
